package com.jianneng.jdg.model.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import com.example.com.jianneng.jdg.R;
import com.jianneng.jdg.model.adapter.MyNewAdapter;
import com.jianneng.jdg.model.gallery.MyNewService;
import com.jianneng.jdg.model.homeactivity.ExamActivity;

public class FragmentApply extends Fragment implements OnClickListener {
private ListView mApplyListView;
private MyNewAdapter mAdapter;//模拟数据

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View view = inflater
				.inflate(R.layout.fragment_apply, container, false);
		mApplyListView = (ListView) view.findViewById(R.id.apply_listview);
		mAdapter = new MyNewAdapter(getActivity(), MyNewService.getMyNew());
		mApplyListView.setAdapter(mAdapter);
		return view;

	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {

		super.onActivityCreated(savedInstanceState);
		mApplyListView.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> parent, View view,
					int position, long id) {
				Toast.makeText(getActivity(), position+"", 1).show();
				Intent intent = new Intent(getActivity(), ExamActivity.class);
				startActivity(intent);
				
			}
		});
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		
	}


}
